package com.hbsi.iodemo3;

import javax.imageio.IIOException;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;

/**
 * @author 程奕红
 * @version 1.0
 */
public class TestReader {
    public static void main(String[] args) {
        String filepath="e:\\cc.txt";
        FileReader fileReader=null;
        char[] buf= new char[8];
        int data;
        try {
            fileReader=new FileReader(filepath);
            while((data=fileReader.read(buf))!=-1){
                System.out.print((char)data);
            }
            System.out.println("读取成功~~");

        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                fileReader.close();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
    }

}
